<%--
  Created by IntelliJ IDEA.
  User: longhunpomie
  Date: 2022/9/27
  Time: 20:22
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<div id="page_nav">
  <c:if test="${requestScope.page.pageNum > 1}">
    <a href="${requestScope.page.url}&pageNum=1">首页</a>
    <a href="${requestScope.page.url}&pageNum=${requestScope.page.pageNum - 1}">上一页</a>
    <a href="${requestScope.page.url}&pageNum=${requestScope.page.pageNum - 1}">${requestScope.page.pageNum - 1}</a>
  </c:if>
  【${requestScope.page.pageNum}】
  <c:if test="${requestScope.page.pageNum < requestScope.page.pageTotalPage}">
    <a href="${requestScope.page.url}&pageNum=${requestScope.page.pageNum + 1}">${requestScope.page.pageNum + 1}</a>
    <a href="${requestScope.page.url}&pageNum=${requestScope.page.pageNum + 1}">下一页</a>
    <a href="${requestScope.page.url}&pageNum=${requestScope.page.pageTotalPage}">末页</a>
  </c:if>
  共${requestScope.page.pageTotalPage}页，${requestScope.page.pageTotalCount}条记录 到第<input value="${requestScope.page.pageNum}" name="pn" id="pn_input"/>页
  <input type="button" value="确定" id="btn">
  <script>
    $(function (){
      $("#btn").click(function (){
        var pageNum = $("#pn_input").val();
        if(pageNum <= ${requestScope.page.pageTotalPage} && pageNum >= 1)
          location.href="${pageScope.basePath}${requestScope.page.url}&pageNum=" + pageNum;
        else alert("页码不正确！");
      });
    });
  </script>
</div>
